| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkScripts::Script Class Referencefinal

Holds all information for a script. More...

Inheritance diagram for nkScripts::Script:

## Public Member Functions
| Script () noexcept
virtual | ~Script ()
INTERPRETER | getTargetInterpreter () const
nkMemory::StringView | getName () const
nkMemory::StringView | getSources () const
const CompilationResult & | getLastCompilationResult () const
void | setTargetInterpreter (INTERPRETER interpreter)
void | setName (nkMemory::StringView name)
void | setSources (nkMemory::StringView sources)
bool | load ()
void | unload ()
virtual void | exportClassToTree (nkExport::Node *rootNode) override
virtual void | importClassFromTree (nkExport::Node *rootNode) override
Public Member Functions inherited from nkExport::Exportable
| Exportable () noexcept
virtual | ~Exportable ()

## Detailed Description

Holds all information for a script.

The holder is also responsible for script compilation and usage within an environment.

## Constructor & Destructor Documentation

## ◆ Script()

nkScripts::Script::Script | ( |  | ) |
| noexcept

Constructor.

## ◆ ~Script()

virtual nkScripts::Script::~Script | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ getTargetInterpreter()

INTERPRETER nkScripts::Script::getTargetInterpreter | ( |  | ) | const

Returns
  The current target interpreter for the script.

## ◆ getName()

nkMemory::StringView nkScripts::Script::getName | ( |  | ) | const

Returns
  The name attached to the script.

## ◆ getSources()

nkMemory::StringView nkScripts::Script::getSources | ( |  | ) | const

Returns
  The sources attached to the script.

## ◆ getLastCompilationResult()

const CompilationResult& nkScripts::Script::getLastCompilationResult | ( |  | ) | const

Returns
  The last compilation attempt result.

## ◆ setTargetInterpreter()

void nkScripts::Script::setTargetInterpreter | ( | INTERPRETER | interpreter | ) |

Sets the interpreter this script should target.

Parameters

  interpreter | The type of interpreter the script should compile for.

## ◆ setName()

void nkScripts::Script::setName | ( | nkMemory::StringView | name | ) |

Sets the name of the script.

Parameters

  name | The name to assign.

Remarks
  In theory, should only be called by the ScriptManager to update the script when needed.

## ◆ setSources()

void nkScripts::Script::setSources | ( | nkMemory::StringView | sources | ) |

Sets the sources the script should compile from.

Parameters

  sources | The sources to assign.

## ◆ load()

bool nkScripts::Script::load | ( |  | ) |

Loads the script. This triggers recompilation and prepares it for intepretation within the Environment.

Returns
  If the loading went well (true) or not (false). If an error occurred, a call to getLastCompilationResult() can be made to check what went wrong.

## ◆ unload()

void nkScripts::Script::unload | ( |  | ) |

Unloads and free all resources linked to compilation within the script.

## ◆ exportClassToTree()

virtual void nkScripts::Script::exportClassToTree | ( | nkExport::Node * | rootNode | ) |
| override virtual

Basic exporting capabilities.

Parameters

  rootNode | The root of the tree to export into.

Implements nkExport::Exportable.

## ◆ importClassFromTree()

virtual void nkScripts::Script::importClassFromTree | ( | nkExport::Node * | rootNode | ) |
| override virtual

Basic importing capabilities.

Parameters

  rootNode | The root of the trree to import from.

Implements nkExport::Exportable.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsScripts/Scripts/Script.h